package com.brother.realtime.config;

import java.nio.ByteBuffer;

public class UpgradeFirmware implements Config {

	private ByteBuffer bf;
	
	private int order = 0;
	
	public void increaseSeq(){
		order++;
	}
	
	public int getCurrentOrder(){
		return order;
	}
	
	public UpgradeFirmware(ByteBuffer bf){
		this.bf = bf;
	}
	
	@Override
	public byte[] getData() {
		this.bf.position(518*order);
		byte[] b = new byte[518];
		this.bf.get(b);
		return b;
	}

	public boolean hasData() {
		return (this.order * 518 < this.bf.capacity());
	}

	public int getSize() {
		return this.bf.capacity();
	}

	public void setPos(int i) {
		this.bf.position(i);
	}

	public void setOrder(int currentFrame) {
		this.order = currentFrame;
	}
}
